package com.xiaoxing.salesclient.mvp.model;

import android.app.Application;

import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;

import com.jess.arms.di.scope.ActivityScope;

import javax.inject.Inject;

import com.xiaoxing.salesclient.mvp.contract.SheZhiContract;
import com.xiaoxing.salesclient.mvp.model.entity.UpdateUserInfo;
import com.xiaoxing.salesclient.mvp.model.entity.UploadMemberImage;
import com.xiaoxing.salesclient.mvp.model.service.SalesService;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;


@ActivityScope
public class SheZhiModel extends BaseModel implements SheZhiContract.Model {
    @Inject
    Gson mGson;
    @Inject
    Application mApplication;

    @Inject
    public SheZhiModel(IRepositoryManager repositoryManager) {
        super(repositoryManager);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.mGson = null;
        this.mApplication = null;
    }

    @Override
    public Observable<UploadMemberImage> uploadMemberImage(RequestBody access_token, MultipartBody.Part cover) {
        return mRepositoryManager.obtainRetrofitService(SalesService.class).uploadMemberImage(access_token, cover);
    }

    @Override
    public Observable<UpdateUserInfo> updateUserInfo(String access_token, String nick_name, String address, String password, String email, String mobile) {
        return mRepositoryManager.obtainRetrofitService(SalesService.class).updateUserInfo(access_token, nick_name, address, password, email, mobile
        );
    }
}